<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\facade\Request;
class Recom extends Controller
{
    protected $middleware = ['VerifyLogin'];

    /*
     * 书架推荐书籍
     * */
    public function bookshelf()
    {
        $RecomLogic = \think\facade\App::model('Recom', 'logic');
        $result = $RecomLogic->getList();

        if($result)
        {
            return json(['code'=>0,'msg'=>'success','data'=>$result]);
        }

        return json(['code'=>102,'msg'=>'数据为空','data'=>[]]);
    }

    /*
     * 首页推荐位
     * */
    public function homepage()
    {
		$params = Request::param('', '', 'strip_tags,trim');
		$params['lang'] = input('lang','zh2cht');
		
        $RecomLogic = \think\facade\App::model('Recom', 'logic');
        $recomHome = $RecomLogic->getHome($params);

        $BannerLogic = \think\facade\App::model('Banner', 'logic');
        $banners = $BannerLogic->getList();

        return json(['code'=>0,'msg'=>'success','data'=>['recoms'=>$recomHome,'banners'=>$banners]]);
    }


}